package com.siyu.tickets.entity.base;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import com.siyu.tickets.entity.Product;
import com.siyu.tickets.entity.Supplier;
import com.siyu.tickets.entity.Ticket;
import com.siyu.tickets.entity.TicketVerify;

public abstract class BaseTicketVerify implements Serializable {

	private static final long serialVersionUID = 6712777409867394991L;

	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private Integer id;

	// fields
	private String ticketCode;
	private String supplierName;
	private String productName;

	private Integer verifyCount;
	private BigDecimal verifyMoney;

	private Date createTime;

	// many to one
	private Product product;
	private Supplier supplier;
	private Ticket ticket;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTicketCode() {
		return ticketCode;
	}

	public String getSupplierName() {
		return supplierName;
	}

	public String getProductName() {
		return productName;
	}

	public Integer getVerifyCount() {
		return verifyCount;
	}

	public void setVerifyCount(Integer verifyCount) {
		this.verifyCount = verifyCount;
	}

	public BigDecimal getVerifyMoney() {
		return verifyMoney;
	}

	public void setVerifyMoney(BigDecimal verifyMoney) {
		this.verifyMoney = verifyMoney;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
		this.productName = product.getName();
	}

	public Supplier getSupplier() {
		return supplier;
	}

	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
		this.supplierName = supplier.getTitle();
	}

	public Ticket getTicket() {
		return ticket;
	}

	public void setTicket(Ticket ticket) {
		this.ticket = ticket;
		this.ticketCode = ticket.getCode();
	}

	public void setTicketCode(String ticketCode) {
		this.ticketCode = ticketCode;
	}

	public void setSupplierName(String supplierName) {
		this.supplierName = supplierName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public boolean equals(Object obj) {
		if (null == obj)
			return false;
		if (!(obj instanceof TicketVerify))
			return false;
		else {
			TicketVerify bean = (TicketVerify) obj;
			if (null == this.getId() || null == bean.getId())
				return false;
			else
				return (this.getId().equals(bean.getId()));
		}
	}

	public int hashCode() {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId())
				return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}

}
